package com.cn.ycy.aop.annation;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 测试调用过程
 */
@Aspect
@Component
public class AopCustomAspectBefore {

  Logger logger = LoggerFactory.getLogger(AopCustomAspectRound.class);

  @Pointcut("execution(public * com.cn.ycy.aop.annation.ServiceImpl.play(..))")
  public void play() {
  }

  @Before(value = "execution(public * com.cn.ycy.aop.annation.ServiceImpl.play(..))")
  public void playBefore1(JoinPoint joinPoint) {
    logger.warn("@before 戴口罩。。。");
  }

  @Before(value = "play()")
  public void playBefore(JoinPoint joinPoint) {
    logger.warn("@before 戴口罩。。。");
  }

  @After(value = "play()")
  public void playAfter() {
    logger.warn("@After 洗手。。。");
  }

}
